package com.lc.midi.keyEvent;

import java.util.ArrayList;
import java.util.List;

public class KeyEvent {
	private int time = 0;
    private List<MidiKey> keyList = new ArrayList<>();

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }

    public List<MidiKey> getKeyList() {
        return keyList;
    }

    public void setKeyList(List<MidiKey> keyList) {
        this.keyList = keyList;
    }

    public void addKey(MidiKey key){
        if (!keyList.contains(key))
            keyList.add(key);
    }

    public void removeKey(MidiKey key){
        keyList.remove(key);
    }

    public void removeKeyByKeyId(int keyId){
        for (var key : keyList ) {
            if (key.getKeyId() == keyId)
                keyList.remove(key);
        }
    }

    public void removeKeyByInstrumentId(int instrumentId) {
        for (var key : keyList) {
            if (key.getInstrumentId() == instrumentId)
                keyList.remove(key);
        }
    }
    
    public void removeKeyByPass(int pass) {
    	for (var key : keyList) {
    		if (key.getPass() == pass)
    			keyList.remove(pass);
    	}
    }
}

